/* 全局样式 */
:root {
  --primary-color: #4f46e5;
  --secondary-color: #818cf8;
  --accent-color: #c084fc;
  --background-color: #f9fafb;
  --card-color: #ffffff;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 16px;
}

/* 模拟iOS设备样式 */
.ios-device {
  width: 390px;
  height: 844px;
  background-color: var(--background-color);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  margin: 20px auto;
  border: 12px solid #000;
}

/* 状态栏 */
.status-bar {
  height: 44px;
  background-color: var(--card-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 10;
}

.status-bar-left {
  display: flex;
  align-items: center;
}

.status-bar-right {
  display: flex;
  align-items: center;
}

.status-bar-time {
  font-weight: 600;
}

.status-bar-battery, .status-bar-wifi, .status-bar-signal {
  margin-left: 6px;
}

/* 内容区域 */
.app-content {
  height: calc(100% - 44px - 83px);
  overflow-y: auto;
  position: relative;
  background-color: var(--background-color);
}

/* 底部导航栏 */
.tab-bar {
  height: 83px;
  background-color: var(--card-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: 20px;
  position: absolute;
  bottom: 0;
  width: 100%;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 20%;
  color: var(--text-tertiary);
  font-size: 10px;
  padding-top: 8px;
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

/* 卡片样式 */
.card {
  background-color: var(--card-color);
  border-radius: 16px;
  padding: 16px;
  margin: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-outline {
  border: 1.5px solid var(--border-color);
  background-color: transparent;
  color: var(--text-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 10px;
}

.btn-icon {
  margin-right: 8px;
}

/* 输入框样式 */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background-color: var(--card-color);
  font-size: 16px;
  transition: border-color 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 头像样式 */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
}

/* 徽章样式 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary {
  background-color: var(--primary-color);
  color: white;
}

.badge-success {
  background-color: var(--success-color);
  color: white;
}

.badge-warning {
  background-color: var(--warning-color);
  color: white;
}

/* 列表样式 */
.list {
  background-color: var(--card-color);
  border-radius: 16px;
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.list-item-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.list-item-right {
  color: var(--text-tertiary);
}

/* 进度条样式 */
.progress-bar {
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 4px;
}

/* 工具类 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: var(--primary-color);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success-color);
}

.text-warning {
  color: var(--warning-color);
}

.text-error {
  color: var(--error-color);
}

.font-bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 12px; }
.ml-4 { margin-left: 16px; }
.ml-5 { margin-left: 20px; }

.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 12px; }
.mr-4 { margin-right: 16px; }
.mr-5 { margin-right: 20px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 12px; }
.rounded-md { border-radius: 8px; }
.rounded-sm { border-radius: 4px; }

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

/* 特定页面样式 */
/* 首页 */
.welcome-header {
  padding: 24px 20px;
  background-color: var(--card-color);
  border-radius: 0 0 24px 24px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.stats-container {
  display: flex;
  justify-content: space-between;
  margin: 16px 12px;
}

.stat-card {
  background-color: var(--card-color);
  border-radius: 16px;
  padding: 16px;
  width: 48%;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 学习页面 */
.topic-card {
  display: flex;
  align-items: center;
  background-color: var(--card-color);
  border-radius: 16px;
  padding: 16px;
  margin: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topic-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  margin-right: 16px;
}

.topic-content {
  flex: 1;
}

.topic-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.topic-progress {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 笔记页面 */
.note-editor {
  background-color: var(--card-color);
  border-radius: 16px;
  padding: 16px;
  margin: 12px;
  min-height: 200px;
}

.note-title-input {
  width: 100%;
  border: none;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  background-color: transparent;
}

.note-content-input {
  width: 100%;
  border: none;
  min-height: 150px;
  font-size: 16px;
  background-color: transparent;
  resize: none;
}

.note-title-input:focus, .note-content-input:focus {
  outline: none;
}

.note-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
}

.note-action-btn {
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 8px;
  cursor: pointer;
}

/* 个人资料页面 */
.profile-header {
  background-color: var(--card-color);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 0 0 24px 24px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-bio {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 16px;
  font-size: 14px;
}

.profile-stats {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 16px;
}

.profile-stat {
  text-align: center;
}

.profile-stat-value {
  font-weight: 700;
  font-size: 18px;
}

.profile-stat-label {
  color: var(--text-secondary);
  font-size: 12px;
}

/* 设置页面 */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin: 16px 16px 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background-color: var(--card-color);
  border-bottom: 1px solid var(--border-color);
}

.settings-item:first-child {
  border-radius: 16px 16px 0 0;
}

.settings-item:last-child {
  border-radius: 0 0 16px 16px;
  border-bottom: none;
}

.settings-item-left {
  display: flex;
  align-items: center;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.settings-item-title {
  font-weight: 500;
}

.settings-item-right {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}